#ifndef _MS_SPONGEBOB_H_

#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <gsl/gsl_histogram.h>
#include <gsl/gsl_randist.h>
#include <gsl/gsl_rng.h>
#include <gsl/gsl_statistics.h>

//--- #include "fe_vecmat.h"
#include "ms_misc.h"
#include "ms_sphere.h"
#include "ms_distribution.h"
#include "ms_voxelimage.h"
#include "ms_distribution.h"


using namespace std;
#define MAX_SPHERES 10

class Range {
	public :
	double lowest, highest;
};


class SpongeBob {
	protected:
		// Vector fCoordinates;
		RandomDistribution *pDistributionUsed; // renamed
		RandomDistribution* CoordDistributionUsed;
		RandomDistribution* CoreDistributionUsed;
		int S_bin;
		double fEdgeLength; // Kantenlaenge des Wuerfels der Materialprobe;
		double minRadius; //min-Wert des Radius
		double maxRadius; //max-Wert des Radius
		sphere* pSpheres;
		
		double getRandomRadius(const int maxTrys = 1000, double min = 0.0, double max = 0.0, Range range = Range()); //+++ wegen Verteilungen mit Wertebereichen außerhalb von [0,1]
		RandomDistribution* pDistributionRadius; //+++ eigene Verteilung für Radien, wenn gewünscht.
		bool bVerbose; //++ if true then SpongeBob will do cout messages;

	public:
		SpongeBob( const int n_spheres = MAX_SPHERES, const double edgeLength = 1.0 ); //*** von 10 auf MAX-SPHERES
		~SpongeBob();
		bool createNewSpheres(RandomDistribution* useDistribution, RandomDistribution* PlaceDistribution , RandomDistribution* CoreDistribution , int S_bin, 
								 double minRadius, double maxRadius, bool bPartialOverlapping, 
								 bool bSameCores, bool bConstRadius); //+++
		bool createRadiusSpheres(RandomDistribution* useDistribution, int S_bin, double minRadius, double maxRadius, bool bPartialOverlapping, bool bSameCores);
		bool createSpheres(RandomDistribution* useDistribution, int S_bin, double minRadius, double maxRadius, bool bPartialOverlapping, bool bSameCores);
		void drawVoxelImage(VoxelImage vx_img, unsigned char color, int nSphereCount); 	
		void PeriodicCopy( const sphere s_in, sphere * s_out );
		
		Range validateRandomValues(RandomDistribution* useDistribution, const int count = 1000);
		
		char CurrentDistributionName[1024];
		char CurrentParameterName[1024];
		bool CancelSbin;

		
		void setDistributionRadius(RandomDistribution* ExponentialDistribution) //+++ eigene Verteilung für Radien, wenn gewünscht.
			{pDistributionRadius = ExponentialDistribution; };
		void setVerbose(bool talk) {bVerbose = talk;}; //+++
};

#define _MS_SPONGEBOB_H_
#endif /* _MS_SPONGEBOB_H_ */

